/****************************************************************************
 *
 *   Copyright (c) 2020-2023 PX4 Development Team. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 * 3. Neither the name PX4 nor the names of its contributors may be
 *    used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 ****************************************************************************/

#include <stdint.h>

static constexpr float SAMPLING_RES = 10;
static constexpr float SAMPLING_MIN_LAT = -90;
static constexpr float SAMPLING_MAX_LAT = 90;
static constexpr float SAMPLING_MIN_LON = -180;
static constexpr float SAMPLING_MAX_LON = 180;

static constexpr int LAT_DIM = 19;
static constexpr int LON_DIM = 37;


// *INDENT-OFF*
// Magnetic declination data in radians * 10^-4
// Model: WMM-2020,
// Version: 0.5.1.11,
// Date: 2023.9315,
static constexpr const int16_t declination_table[19][37] {
	//    LONGITUDE:   -180,  -170,  -160,  -150,  -140,  -130,  -120,  -110,  -100,   -90,   -80,   -70,   -60,   -50,   -40,   -30,   -20,   -10,     0,    10,    20,    30,    40,    50,    60,    70,    80,    90,   100,   110,   120,   130,   140,   150,   160,   170,   180,
	/* LAT: -90 */ {  25952, 24207, 22462, 20716, 18971, 17226, 15480, 13735, 11990, 10244,  8499,  6754,  5008,  3263,  1518,  -228, -1973, -3718, -5464, -7209, -8954,-10700,-12445,-14190,-15936,-17681,-19426,-21172,-22917,-24662,-26408,-28153,-29898, 31188, 29443, 27698, 25952, },
	/* LAT: -80 */ {  22515, 20388, 18451, 16680, 15041, 13504, 12041, 10631,  9256,  7907,  6575,  5257,  3949,  2644,  1336,    15, -1327, -2701, -4113, -5568, -7065, -8604,-10184,-11806,-13472,-15192,-16980,-18855,-20840,-22960,-25236,-27672,-30240, 29955, 27341, 24840, 22515, },
	/* LAT: -70 */ {  14987, 13586, 12457, 11491, 10619,  9784,  8940,  8050,  7096,  6077,  5006,  3914,  2831,  1778,   758,  -252, -1290, -2400, -3606, -4912, -6299, -7734, -9185,-10630,-12058,-13476,-14907,-16397,-18027,-19952,-22493,-26319, 30594, 24093, 19618, 16857, 14987, }, // WARNING! black out zone
	/* LAT: -60 */ {   8456,  8203,  7915,  7635,  7375,  7116,  6804,  6367,  5748,  4925,  3922,  2811,  1694,   672,  -201,  -953, -1681, -2509, -3523, -4733, -6074, -7452, -8776, -9988,-11051,-11947,-12661,-13154,-13326,-12878,-10764, -3393,  5042,  7739,  8486,  8600,  8456, }, // WARNING! black out zone
	/* LAT: -50 */ {   5513,  5546,  5485,  5391,  5312,  5270,  5232,  5101,  4752,  4084,  3068,  1793,   455,  -714, -1569, -2118, -2506, -2950, -3652, -4689, -5953, -7241, -8384, -9282, -9872,-10100, -9893, -9123, -7604, -5234, -2323,   426,  2537,  3963,  4837,  5311,  5513, },
	/* LAT: -40 */ {   3975,  4066,  4070,  4020,  3955,  3918,  3920,  3906,  3728,  3186,  2154,   705,  -856, -2156, -2999, -3430, -3598, -3650, -3832, -4437, -5448, -6539, -7421, -7947, -8037, -7640, -6733, -5341, -3634, -1941,  -488,   732,  1778,  2649,  3309,  3743,  3975, },
	/* LAT: -30 */ {   3001,  3086,  3112,  3091,  3028,  2945,  2882,  2846,  2717,  2231,  1182,  -348, -1953, -3190, -3909, -4235, -4296, -4064, -3626, -3441, -3853, -4621, -5312, -5643, -5497, -4891, -3920, -2717, -1522,  -590,    80,   678,  1305,  1916,  2432,  2799,  3001, },
	/* LAT: -20 */ {   2358,  2403,  2415,  2409,  2361,  2262,  2150,  2072,  1926,  1423,   351, -1150, -2624, -3666, -4175, -4270, -4047, -3468, -2599, -1824, -1589, -1972, -2624, -3079, -3098, -2724, -2082, -1271,  -509,   -32,   222,   521,   967,  1455,  1886,  2200,  2358, },
	/* LAT: -10 */ {   1964,  1957,  1930,  1919,  1885,  1795,  1679,  1584,  1398,   842,  -233, -1618, -2883, -3691, -3931, -3679, -3089, -2300, -1456,  -713,  -268,  -325,  -807, -1309, -1510, -1410, -1093,  -598,  -111,   118,   157,   313,   690,  1140,  1544,  1840,  1964, },
	/* LAT:   0 */ {   1751,  1716,  1654,  1638,  1621,  1546,  1433,  1314,  1058,   434,  -614, -1842, -2885, -3449, -3422, -2902, -2128, -1349,  -703,  -173,   233,   330,    37,  -380,  -628,  -679,  -581,  -323,   -40,    39,   -33,    51,   399,   855,  1286,  1616,  1751, },
	/* LAT:  10 */ {   1611,  1618,  1570,  1581,  1601,  1546,  1416,  1223,   845,   127,  -896, -1968, -2781, -3100, -2875, -2256, -1477,  -771,  -263,   113,   435,   575,   403,    80,  -150,  -258,  -285,  -210,  -112,  -162,  -310,  -288,    21,   487,   979,  1395,  1611, },
	/* LAT:  20 */ {   1419,  1567,  1624,  1712,  1795,  1769,  1607,  1299,   753,  -101, -1141, -2084, -2666, -2758, -2417, -1807, -1096,  -451,     2,   307,   564,   704,   606,   362,   165,    45,   -53,  -126,  -213,  -409,  -652,  -713,  -473,   -15,   534,  1058,  1419, },
	/* LAT:  30 */ {   1106,  1471,  1730,  1953,  2111,  2119,  1926,  1500,   772,  -253, -1362, -2226, -2627, -2552, -2146, -1564,  -908,  -293,   164,   465,   694,   835,   809,   659,   511,   384,   218,    -4,  -296,  -675, -1047, -1205, -1040,  -607,   -27,   584,  1106, },
	/* LAT:  40 */ {    734,  1319,  1814,  2208,  2458,  2501,  2285,  1751,   841,  -378, -1603, -2454, -2762, -2603, -2154, -1560,  -906,  -279,   227,   587,   854,  1048,  1135,  1122,  1046,   894,   615,   190,  -360,  -971, -1491, -1730, -1608, -1188,  -590,    79,   734, },
	/* LAT:  50 */ {    428,  1172,  1855,  2416,  2787,  2897,  2671,  2021,   888,  -593, -1996, -2895, -3182, -2987, -2496, -1850, -1140,  -445,   168,   670,  1084,  1434,  1708,  1874,  1889,  1695,  1235,   509,  -398, -1302, -1974, -2252, -2121, -1681, -1052,  -329,   428, },
	/* LAT:  60 */ {    208,  1056,  1863,  2564,  3077,  3299,  3096,  2301,   812, -1114, -2805, -3776, -4028, -3771, -3202, -2459, -1636,  -799,     6,   754,  1443,  2069,  2607,  2996,  3146,  2945,  2285,  1144,  -285, -1601, -2457, -2755, -2587, -2099, -1417,  -630,   208, },
	/* LAT:  70 */ {    -70,   858,  1754,  2556,  3179,  3487,  3262,  2180,    33, -2597, -4529, -5370, -5400, -4934, -4177, -3252, -2235, -1175,  -105,   951,  1973,  2935,  3799,  4500,  4937,  4952,  4314,  2801,   574, -1537, -2821, -3256, -3098, -2576, -1840,  -985,   -70, }, // WARNING! black out zone
	/* LAT:  80 */ {   -920,    -2,   846,  1538,  1932,  1791,   724, -1605, -4558, -6653, -7479, -7425, -6852, -5974, -4911, -3732, -2481, -1186,   131,  1453,  2764,  4044,  5271,  6410,  7409,  8171,  8512,  8044,  6013,  2014, -1698, -3391, -3721, -3373, -2689, -1839,  -920, }, // WARNING! black out zone
	/* LAT:  90 */ { -29309,-27563,-25818,-24073,-22327,-20582,-18837,-17091,-15346,-13601,-11855,-10110, -8365, -6619, -4874, -3129, -1383,   362,  2107,  3853,  5598,  7343,  9089, 10834, 12579, 14325, 16070, 17815, 19561, 21306, 23051, 24797, 26542, 28287, 30033,-31054,-29309, }, // WARNING! black out zone
};
static constexpr float WMM_DECLINATION_MIN_RAD = -3.105; // latitude: 90, longitude: 170
static constexpr float WMM_DECLINATION_MAX_RAD = 3.119; // latitude: -90, longitude: 150


// Magnetic inclination data in radians * 10^-4
// Model: WMM-2020,
// Version: 0.5.1.11,
// Date: 2023.9315,
static constexpr const int16_t inclination_table[19][37] {
	//    LONGITUDE:   -180,  -170,  -160,  -150,  -140,  -130,  -120,  -110,  -100,   -90,   -80,   -70,   -60,   -50,   -40,   -30,   -20,   -10,     0,    10,    20,    30,    40,    50,    60,    70,    80,    90,   100,   110,   120,   130,   140,   150,   160,   170,   180,
	/* LAT: -90 */ { -12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563,-12563, },
	/* LAT: -80 */ { -13645,-13511,-13350,-13170,-12977,-12775,-12572,-12372,-12182,-12006,-11850,-11716,-11606,-11520,-11456,-11414,-11394,-11397,-11424,-11478,-11562,-11677,-11822,-11996,-12195,-12412,-12642,-12875,-13102,-13315,-13501,-13650,-13753,-13803,-13799,-13744,-13645, },
	/* LAT: -70 */ { -14092,-13773,-13454,-13131,-12800,-12457,-12103,-11746,-11405,-11098,-10847,-10665,-10554,-10501,-10487,-10488,-10493,-10500,-10522,-10577,-10686,-10862,-11110,-11427,-11802,-12221,-12670,-13135,-13601,-14053,-14469,-14811,-14996,-14938,-14706,-14408,-14092, }, // WARNING! black out zone
	/* LAT: -60 */ { -13510,-13156,-12817,-12484,-12141,-11769,-11354,-10900,-10434,-10007, -9680, -9509, -9510, -9649, -9852,-10040,-10158,-10194,-10176,-10159,-10207,-10370,-10664,-11078,-11581,-12139,-12726,-13323,-13912,-14473,-14971,-15259,-15076,-14688,-14280,-13885,-13510, }, // WARNING! black out zone
	/* LAT: -50 */ { -12492,-12149,-11817,-11494,-11170,-10824,-10425, -9955, -9427, -8909, -8525, -8408, -8618, -9083, -9646,-10150,-10498,-10648,-10606,-10446,-10304,-10316,-10548,-10973,-11521,-12116,-12702,-13239,-13683,-13979,-14085,-14011,-13807,-13523,-13193,-12844,-12492, },
	/* LAT: -40 */ { -11239,-10888,-10538,-10192, -9853, -9515, -9156, -8732, -8213, -7652, -7234, -7207, -7682, -8513, -9433,-10255,-10903,-11323,-11443,-11258,-10908,-10643,-10651,-10945,-11415,-11920,-12362,-12678,-12833,-12837,-12748,-12612,-12435,-12204,-11917,-11588,-11239, },
	/* LAT: -30 */ {  -9603, -9219, -8835, -8443, -8051, -7678, -7324, -6937, -6425, -5817, -5376, -5482, -6276, -7490, -8739, -9825,-10728,-11423,-11800,-11766,-11378,-10870,-10549,-10564,-10823,-11145,-11396,-11502,-11435,-11259,-11088,-10959,-10818,-10613,-10332, -9985, -9603, },
	/* LAT: -20 */ {  -7374, -6924, -6500, -6069, -5625, -5197, -4811, -4404, -3842, -3160, -2727, -3020, -4165, -5794, -7417, -8770, -9817,-10574,-10990,-11002,-10620, -9997, -9445, -9213, -9270, -9434, -9570, -9581, -9405, -9134, -8946, -8869, -8774, -8571, -8255, -7839, -7374, },
	/* LAT: -10 */ {  -4419, -3870, -3407, -2966, -2508, -2059, -1651, -1206,  -588,   108,   450,   -14, -1381, -3318, -5286, -6868, -7936, -8546, -8791, -8710, -8282, -7584, -6922, -6587, -6554, -6648, -6761, -6780, -6589, -6295, -6150, -6175, -6150, -5941, -5557, -5024, -4419, },
	/* LAT:   0 */ {   -912,  -273,   203,   610,  1030,  1446,  1830,  2261,  2833,  3399,  3581,  3053,  1722,  -210, -2248, -3868, -4842, -5244, -5285, -5101, -4643, -3912, -3207, -2845, -2788, -2855, -2976, -3047, -2916, -2684, -2641, -2805, -2888, -2711, -2286, -1648,  -912, },
	/* LAT:  10 */ {   2555,  3196,  3640,  3985,  4342,  4708,  5054,  5429,  5868,  6226,  6246,  5733,  4625,  3041,  1354,     4,  -770,  -993,  -886,  -640,  -215,   436,  1069,  1400,  1463,  1425,  1328,  1237,  1278,  1377,  1290,  1003,   791,   854,  1207,  1817,  2555, },
	/* LAT:  20 */ {   5412,  5950,  6336,  6635,  6949,  7291,  7629,  7968,  8290,  8481,  8381,  7903,  7051,  5946,  4824,  3932,  3424,  3324,  3486,  3737,  4076,  4549,  5010,  5263,  5322,  5311,  5267,  5208,  5193,  5170,  4986,  4639,  4327,  4231,  4404,  4832,  5412, },
	/* LAT:  30 */ {   7567,  7945,  8266,  8550,  8859,  9205,  9559,  9894, 10163, 10268, 10114,  9684,  9048,  8335,  7679,  7177,  6897,  6868,  7019,  7236,  7487,  7791,  8081,  8254,  8314,  8332,  8338,  8328,  8302,  8214,  7985,  7624,  7260,  7037,  7021,  7219,  7567, },
	/* LAT:  40 */ {   9266,  9487,  9744, 10030, 10356, 10715, 11080, 11414, 11661, 11737, 11582, 11218, 10744, 10273,  9881,  9603,  9461,  9464,  9581,  9747,  9926, 10113, 10286, 10411, 10490, 10554, 10612, 10646, 10626, 10511, 10264,  9909,  9538,  9251,  9109,  9122,  9266, },
	/* LAT:  50 */ {  10802, 10922, 11123, 11392, 11713, 12065, 12417, 12730, 12948, 13004, 12863, 12565, 12202, 11859, 11587, 11404, 11315, 11317, 11387, 11494, 11610, 11729, 11846, 11962, 12082, 12207, 12322, 12394, 12382, 12252, 12002, 11672, 11331, 11046, 10857, 10776, 10802, },
	/* LAT:  60 */ {  12320, 12391, 12539, 12754, 13022, 13320, 13620, 13884, 14059, 14086, 13951, 13704, 13417, 13148, 12929, 12776, 12688, 12659, 12678, 12728, 12798, 12885, 12992, 13126, 13286, 13464, 13628, 13736, 13738, 13614, 13387, 13107, 12829, 12593, 12423, 12331, 12320, },
	/* LAT:  70 */ {  13757, 13797, 13889, 14028, 14205, 14406, 14612, 14792, 14897, 14881, 14748, 14550, 14334, 14132, 13960, 13826, 13733, 13680, 13662, 13676, 13720, 13793, 13898, 14036, 14204, 14392, 14576, 14715, 14758, 14683, 14520, 14321, 14127, 13962, 13842, 13772, 13757, }, // WARNING! black out zone
	/* LAT:  80 */ {  14991, 15002, 15037, 15094, 15168, 15250, 15327, 15373, 15360, 15288, 15180, 15059, 14938, 14825, 14727, 14645, 14584, 14544, 14525, 14530, 14557, 14607, 14679, 14773, 14885, 15013, 15149, 15281, 15389, 15431, 15388, 15298, 15201, 15115, 15049, 15007, 14991, }, // WARNING! black out zone
	/* LAT:  90 */ {  15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, 15400, }, // WARNING! black out zone
};
static constexpr float WMM_INCLINATION_MIN_RAD = -1.526; // latitude: -60, longitude: 130
static constexpr float WMM_INCLINATION_MAX_RAD = 1.543; // latitude: 80, longitude: 110


// Magnetic strength data in milli-Gauss * 10
// Model: WMM-2020,
// Version: 0.5.1.11,
// Date: 2023.9315,
static constexpr const int16_t strength_table[19][37] {
	//    LONGITUDE:  -180, -170, -160, -150, -140, -130, -120, -110, -100,  -90,  -80,  -70,  -60,  -50,  -40,  -30,  -20,  -10,    0,   10,   20,   30,   40,   50,   60,   70,   80,   90,  100,  110,  120,  130,  140,  150,  160,  170,  180,
	/* LAT: -90 */ {  5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, 5443, },
	/* LAT: -80 */ {  6050, 5985, 5906, 5813, 5710, 5598, 5479, 5357, 5235, 5115, 5001, 4896, 4803, 4723, 4661, 4616, 4592, 4591, 4613, 4659, 4731, 4825, 4940, 5073, 5217, 5367, 5517, 5660, 5791, 5905, 5997, 6066, 6110, 6128, 6123, 6097, 6050, },
	/* LAT: -70 */ {  6294, 6160, 6008, 5842, 5663, 5470, 5264, 5049, 4831, 4616, 4414, 4232, 4075, 3945, 3841, 3765, 3718, 3707, 3736, 3813, 3943, 4124, 4354, 4623, 4919, 5227, 5531, 5815, 6064, 6268, 6418, 6513, 6553, 6544, 6493, 6408, 6294, },
	/* LAT: -60 */ {  6180, 5986, 5783, 5573, 5353, 5118, 4861, 4583, 4291, 4002, 3736, 3509, 3331, 3197, 3099, 3025, 2975, 2955, 2982, 3074, 3245, 3499, 3828, 4216, 4640, 5074, 5496, 5879, 6203, 6451, 6613, 6690, 6691, 6626, 6511, 6358, 6180, },
	/* LAT: -50 */ {  5839, 5607, 5373, 5141, 4908, 4662, 4391, 4088, 3759, 3428, 3127, 2889, 2729, 2639, 2591, 2556, 2521, 2493, 2499, 2573, 2750, 3045, 3445, 3919, 4427, 4933, 5407, 5825, 6163, 6403, 6540, 6579, 6535, 6423, 6260, 6060, 5839, },
	/* LAT: -40 */ {  5389, 5142, 4896, 4655, 4420, 4182, 3927, 3642, 3328, 3003, 2705, 2484, 2369, 2345, 2364, 2383, 2386, 2372, 2358, 2388, 2523, 2805, 3229, 3747, 4295, 4818, 5282, 5668, 5959, 6146, 6233, 6234, 6163, 6031, 5849, 5629, 5389, },
	/* LAT: -30 */ {  4876, 4634, 4393, 4158, 3931, 3711, 3492, 3261, 3005, 2729, 2472, 2291, 2224, 2251, 2317, 2388, 2451, 2499, 2518, 2529, 2600, 2807, 3177, 3670, 4203, 4698, 5113, 5426, 5627, 5726, 5752, 5724, 5644, 5511, 5331, 5113, 4876, },
	/* LAT: -20 */ {  4320, 4105, 3895, 3690, 3493, 3310, 3141, 2977, 2799, 2600, 2409, 2277, 2240, 2286, 2376, 2487, 2614, 2740, 2824, 2857, 2883, 2985, 3233, 3623, 4076, 4501, 4846, 5077, 5179, 5186, 5156, 5109, 5027, 4899, 4732, 4534, 4320, },
	/* LAT: -10 */ {  3789, 3627, 3473, 3326, 3190, 3070, 2966, 2873, 2774, 2658, 2536, 2438, 2396, 2424, 2513, 2643, 2799, 2955, 3075, 3134, 3148, 3178, 3307, 3564, 3893, 4215, 4477, 4636, 4669, 4616, 4548, 4485, 4397, 4273, 4123, 3958, 3789, },
	/* LAT:   0 */ {  3412, 3318, 3233, 3159, 3103, 3065, 3038, 3017, 2991, 2942, 2862, 2769, 2691, 2664, 2710, 2814, 2947, 3081, 3194, 3267, 3297, 3320, 3398, 3560, 3771, 3985, 4164, 4268, 4271, 4203, 4115, 4023, 3912, 3780, 3646, 3521, 3412, },
	/* LAT:  10 */ {  3282, 3250, 3229, 3224, 3248, 3295, 3349, 3400, 3433, 3422, 3353, 3239, 3114, 3023, 3000, 3044, 3126, 3225, 3325, 3409, 3472, 3535, 3625, 3746, 3883, 4023, 4142, 4211, 4212, 4149, 4038, 3894, 3732, 3573, 3437, 3339, 3282, },
	/* LAT:  20 */ {  3399, 3400, 3425, 3478, 3568, 3688, 3816, 3931, 4010, 4022, 3948, 3807, 3641, 3505, 3433, 3423, 3460, 3535, 3632, 3729, 3821, 3920, 4032, 4145, 4255, 4368, 4471, 4536, 4545, 4485, 4346, 4143, 3915, 3705, 3541, 3439, 3399, },
	/* LAT:  30 */ {  3722, 3726, 3779, 3876, 4018, 4188, 4362, 4517, 4624, 4650, 4577, 4422, 4236, 4074, 3972, 3929, 3935, 3988, 4076, 4175, 4274, 4381, 4498, 4616, 4736, 4865, 4986, 5072, 5097, 5037, 4879, 4638, 4363, 4108, 3908, 3779, 3722, },
	/* LAT:  40 */ {  4222, 4217, 4279, 4400, 4565, 4751, 4933, 5089, 5194, 5220, 5152, 5005, 4821, 4649, 4524, 4451, 4427, 4452, 4514, 4595, 4682, 4780, 4896, 5029, 5181, 5344, 5496, 5605, 5642, 5585, 5428, 5189, 4915, 4656, 4445, 4298, 4222, },
	/* LAT:  50 */ {  4832, 4821, 4873, 4980, 5124, 5282, 5432, 5554, 5628, 5638, 5576, 5451, 5290, 5129, 4993, 4898, 4845, 4835, 4861, 4913, 4983, 5075, 5195, 5345, 5521, 5706, 5872, 5988, 6030, 5983, 5851, 5655, 5432, 5217, 5037, 4906, 4832, },
	/* LAT:  60 */ {  5393, 5376, 5400, 5460, 5544, 5638, 5725, 5793, 5828, 5821, 5768, 5676, 5557, 5430, 5312, 5218, 5152, 5120, 5119, 5147, 5205, 5292, 5411, 5558, 5725, 5893, 6039, 6141, 6183, 6159, 6076, 5951, 5807, 5665, 5542, 5449, 5393, },
	/* LAT:  70 */ {  5726, 5703, 5698, 5708, 5728, 5754, 5778, 5794, 5795, 5778, 5740, 5685, 5616, 5541, 5468, 5405, 5358, 5331, 5327, 5347, 5392, 5462, 5554, 5663, 5780, 5894, 5992, 6064, 6102, 6105, 6076, 6023, 5957, 5886, 5820, 5766, 5726, },
	/* LAT:  80 */ {  5790, 5772, 5756, 5743, 5733, 5723, 5713, 5702, 5688, 5670, 5649, 5625, 5599, 5572, 5548, 5529, 5515, 5511, 5516, 5532, 5558, 5593, 5636, 5684, 5733, 5781, 5823, 5858, 5881, 5894, 5896, 5889, 5874, 5855, 5833, 5811, 5790, },
	/* LAT:  90 */ {  5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, 5685, },
};
static constexpr float WMM_STRENGTH_MIN_GS = 22.2; // latitude: -30, longitude: -60
static constexpr float WMM_STRENGTH_MAX_GS = 66.9; // latitude: -60, longitude: 140
static constexpr float WMM_STRENGTH_MEAN_GS = 46.4;
static constexpr float WMM_STRENGTH_MEDIAN_GS = 48.8;


